import { observable, computed, action, autorun } from "mobx";
import { ApiOfAppVersion } from '#/utils/commonApiDefine';

class Store {
  @observable version = 'cluster';
  @observable breadcrumbs = [];


  @action setVersion(version) {
    this.version = version;
  }
  @action setBreadcrumbs(breadcrumbs = []) {
    this.breadcrumbs = breadcrumbs;
  }

  @action checkAppVersion() {
  	let that = this;
    ApiOfAppVersion().then(
      action("setVersion", data => {
        this.version = data.data;
      }),
      action("setVersion", error => {
        this.version = 'cluster';
      })
    )
  }
}

const store = new Store();
autorun(() => store.checkAppVersion());
export default store;
